using System;
using System.Data;
using System.Collections.Generic;

namespace shfa.snomtastic.data.business
{
    public partial class SettingController
    {
		private SettingInfo ObjectFromDataRow(DataRow dr)
        {
            if (dr != null)
            {
				SettingInfo obj = new SettingInfo();
				obj.SettingId = dr.Field<Guid>("SettingId"); 
				obj.CategoryId = dr.Field<Guid>("CategoryId"); 
				obj.SubcategoryId = dr.Field<Guid>("SubcategoryId"); 
				obj.Name = dr.Field<String>("Name"); 
				obj.SettingIndex = (dr["SettingIndex"] != DBNull.Value) ? dr.Field<Int32>("SettingIndex") : -1; 
				obj.Encrypted = dr.Field<Boolean>("Encrypted"); 
				return obj;
            }
            return null;
        }

        private List<SettingInfo> ListFromDataTable(DataTable dt)
        {
            List<SettingInfo> lst = new List<SettingInfo>();

            foreach (DataRow dr in dt.Rows)
            {
                lst.Add(ObjectFromDataRow(dr));
            }

            return lst;
        }
    }
}
